package com.hyt.it.ogt.controller.ykcj.grade;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hyt.it.ogt.controller.base.BaseController;
import com.hyt.it.ogt.ykcj.common.annotation.Log;
import com.hyt.it.ogt.ykcj.common.core.domain.AjaxResult;
import com.hyt.it.ogt.ykcj.common.core.page.TableDataInfo;
import com.hyt.it.ogt.ykcj.common.enums.BusinessType;
import com.hyt.it.ogt.ykcj.common.utils.poi.ExcelUtil;
import com.hyt.it.ogt.ykcj.domain.grade.ServantExamineeSubjectGrade;
import com.hyt.it.ogt.ykcj.service.grade.IServantExamineeSubjectGradeService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiSort;

/**
 * 公务员考生科目成绩Controller
 * 
 * @author admin
 * @date 2021-09-09
 */
@Api(tags = "grade.4.公务员考生科目成绩", value = "公务员考生科目成绩请求接口")
@ApiSort(value = 204)
@RestController
@RequestMapping("/grade/examineeSubjectGrade")
public class ServantExamineeSubjectGradeController extends BaseController
{
    @Autowired
    private IServantExamineeSubjectGradeService servantExamineeSubjectGradeService;

    /**
     * 查询公务员考生科目成绩列表
     */
    @ApiOperation("查询公务员考生科目成绩列表")
    @GetMapping("/list")
    public TableDataInfo list(ServantExamineeSubjectGrade servantExamineeSubjectGrade)
    {
        startPage();
        List<ServantExamineeSubjectGrade> list = servantExamineeSubjectGradeService.selectServantExamineeSubjectGradeList(servantExamineeSubjectGrade);
        return getDataTable(list);
    }

    /**
     * 导出公务员考生科目成绩列表
     */
    @ApiOperation("导出公务员考生科目成绩列表")
    @Log(title = "公务员考生科目成绩", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ServantExamineeSubjectGrade servantExamineeSubjectGrade)
    {
        List<ServantExamineeSubjectGrade> list = servantExamineeSubjectGradeService.selectServantExamineeSubjectGradeList(servantExamineeSubjectGrade);
        ExcelUtil<ServantExamineeSubjectGrade> util = new ExcelUtil<ServantExamineeSubjectGrade>(ServantExamineeSubjectGrade.class);
        return util.exportExcel(list, "公务员考生科目成绩数据");
    }

    /**
     * 获取公务员考生科目成绩详细信息
     */
    @ApiOperation("获取公务员考生科目成绩详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(servantExamineeSubjectGradeService.selectServantExamineeSubjectGradeById(id));
    }

    /**
     * 新增公务员考生科目成绩
     */
    @ApiOperation("新增公务员考生科目成绩")
    @Log(title = "公务员考生科目成绩", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ServantExamineeSubjectGrade servantExamineeSubjectGrade)
    {
        return toAjax(servantExamineeSubjectGradeService.insertServantExamineeSubjectGrade(servantExamineeSubjectGrade));
    }

    /**
     * 修改公务员考生科目成绩
     */
    @ApiOperation("修改公务员考生科目成绩")
    @Log(title = "公务员考生科目成绩", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ServantExamineeSubjectGrade servantExamineeSubjectGrade)
    {
        return toAjax(servantExamineeSubjectGradeService.updateServantExamineeSubjectGrade(servantExamineeSubjectGrade));
    }

    /**
     * 删除公务员考生科目成绩
     */
    @ApiOperation("删除公务员考生科目成绩")
    @Log(title = "公务员考生科目成绩", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(servantExamineeSubjectGradeService.deleteServantExamineeSubjectGradeByIds(ids));
    }
}
